package com.link2room.ironhide.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * Created by sss on 2016/12/9.
 */
@Entity
@Table(name = "l2r_commission")
@DynamicInsert
public class L2RCommission extends BaseEntity{
    private String commCode;
    private BigDecimal comm;
    private String pbChannel;
    private String resType;

    @Basic
    @Column(name = "comm_code", nullable = true, length = 16)
    public String getCommCode() {
        return commCode;
    }

    public void setCommCode(String commCode) {
        this.commCode = commCode;
    }

    @Basic
    @Column(name = "comm", nullable = false, precision = 12,scale = 2)
    public BigDecimal getComm() {
        return comm;
    }

    public void setComm(BigDecimal comm) {
        this.comm = comm;
    }

    @Basic
    @Column(name = "pb_channel", nullable = true, length = 16)
    public String getPbChannel() {
        return pbChannel;
    }

    public void setPbChannel(String pbChannel) {
        this.pbChannel = pbChannel;
    }

    @Basic
    @Column(name = "res_type", nullable = true, length = 16)
    public String getResType() {
        return resType;
    }

    public void setResType(String resType) {
        this.resType = resType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        L2RCommission that = (L2RCommission) o;

        if (commCode != null ? !commCode.equals(that.commCode) : that.commCode != null) return false;
        if (comm != null ? !comm.equals(that.comm) : that.comm != null) return false;
        if (pbChannel != null ? !pbChannel.equals(that.pbChannel) : that.pbChannel != null) return false;
        return resType != null ? resType.equals(that.resType) : that.resType == null;

    }

    @Override
    public int hashCode() {
        int result = commCode != null ? commCode.hashCode() : 0;
        result = 31 * result + (comm != null ? comm.hashCode() : 0);
        result = 31 * result + (pbChannel != null ? pbChannel.hashCode() : 0);
        result = 31 * result + (resType != null ? resType.hashCode() : 0);
        return result;
    }
}
